<template>
	<view>
		<scroll-view class="scroll-view" scroll-y="true" show-scrollbar="true">
			<view class="top_bg">
				<image :src="pageData.fundImg" class="images" />
				<view class="p">
					{{pageData.fundContent}}
				</view>
			</view>
			<view class="records">
				<view class="txt">申请记录</view>
				<view class="record" v-for="item in loveList" :key="item.id">
					<view class="r-left">
						<view class="name">{{item.nickname}}</view>
						<view class="label">{{item.type}}</view>
						<view class="date">{{item.createTime.split(' ')[0]}}</view>
					</view>
					<view class="r-right">
						<image v-if="item.status==0" class="image" src="/static/images/ok.png" mode=""></image>
						<text class="txt">{{statusChange(item.status).txt}}</text>
					</view>
				</view>
			</view>
		</scroll-view>
		<button class="btn" @click="applyClick">立即申请</button>
	</view>
</template>

<script>
	import {
		getLoveList,
		getQueryRedConfig
	} from '@/api/menu.js'

	export default {
		data() {
			return {
				loveList: [],
				pageData: {}
			}
		},
		onShow() {
			this.getQueryRedConfigRequest()
			this.getLoveListReques()
		},
		methods: {
			// 状态文字检查
			statusChange(type) {
				if (!type) return {
					txt: '审批中'
				}
				if (type == 1) return {
					txt: '待放款'
				}
				if (type == 2) return {
					txt: '已完成'
				}
				if (type == 3) return {
					txt: '已拒绝'
				}
			},
			// 获取记录数据
			getLoveListReques() {
				getLoveList().then((res) => {
					this.loveList = res.data.list || []
				})
			},
			// 获取记录数据
			getQueryRedConfigRequest() {
				let that = this;
				getQueryRedConfig().then((res) => {
					this.pageData = res.data || {}
				})
			},
			// 立即申请
			applyClick() {
				uni.navigateTo({
					url: '/pages/love_funds/love_fund_applyfor/index'
				})
			}
		}
	}
</script>
<style>
	page {
		display: flex;
		flex-direction: column;
		height: 100%;
		/* #ifdef H5 */
		background-color: #F5F6F7;
		/* #endif */
		padding: 24rpx 41rpx;
	}
</style>
<style lang="scss" scoped>
	@import url("../../static/css/gstyle.scss");



	.btn {
		position: fixed;
		bottom: 0;
		width: calc(100% - 82rpx);
	}

	.top_bg {
		padding: 1rpx;
		background: white;

		.p {
			text-indent: 4ch;
		}

		.images {
			width: 100%;
			height: 304rpx
		}
	}

	.records {
		.txt {
			margin: 66rpx 0 22rpx 0;
		}

		.record {
			display: flex;
			align-items: center;
			justify-content: space-between;
			background: white;
			padding: 10rpx;
			margin-bottom: 14rpx;

			.r-left {
				display: flex;
				flex-direction: column;
				justify-content: space-between;

				.label {
					text-align: center;
					background: rgba(234, 109, 7, 0.15);
					border-radius: 4px;
					font-size: 22rpx;
					color: #EA6D07;
					margin: 9rpx 0;
				}

				.date {
					font-size: 22rpx;
					color: #999999;
				}
			}

			.r-right {


				.image {
					width: 30rpx;
					height: 21rpx;
					margin-right: 10rpx;
				}

				.txt {
					font-size: 22rpx;
					color: #5CC02C;
				}
			}
		}
	}
</style>